// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   getKeyColumn.java

package include.get_sql;

import include.nseer_db.nseer_db;
import java.sql.ResultSet;
import java.util.StringTokenizer;

public class getKeyColumn
{

	private String dbase;
	private String tableName;
	private nseer_db erp_db;
	private String column[];

	public getKeyColumn()
	{
		dbase = "";
		tableName = "";
		column = new String[1];
	}

	public String[] Column(String database, String tName)
	{
		dbase = database;
		tableName = tName;
		erp_db = new nseer_db(dbase);
		String column_group = "";
		try
		{
			String sql1 = (new StringBuilder("select * from security_publicconfig_key where tablename='")).append(tableName).append("'").toString();
			ResultSet rs = erp_db.executeQuery(sql1);
			if (rs.next())
			{
				column_group = rs.getString("column_group");
				int i = 0;
				for (StringTokenizer tokenTO = new StringTokenizer(column_group, ","); tokenTO.hasMoreTokens();)
				{
					String a = tokenTO.nextToken();
					i++;
				}

				column = new String[i];
				i = 0;
				for (StringTokenizer tokenTO1 = new StringTokenizer(column_group, ","); tokenTO1.hasMoreTokens();)
				{
					column[i] = tokenTO1.nextToken();
					i++;
				}

			} else
			{
				column = null;
			}
			erp_db.close();
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
		return column;
	}
}
